package Calendar;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/*
      public static Calendar lgetInstance()               获取当前时间的日历对象
      public final Date getTime()                         获取日期对象
      public final setTime(Date date)                     给日历设置日期对象
      public long getTimeInMillis()                       拿到时间毫秒值
      public void setTimeInMillis(long millis)            给日历设置时间毫秒值
      public int get(int field)                           获取日期中的某个字段信息
      public void set(int field,int value)                修改日历的某个字段信息
      public void add(int field,int amount)               为某个字段增加/减少指定的值
      */
public class CalendarDemo1 {
    public static void main(String[] args) {
        Calendar c=Calendar.getInstance();
        c.set(Calendar.YEAR,2025);
        c.set(Calendar.MONTH,9);
        c.set(Calendar.DAY_OF_MONTH,1);
        c.add(Calendar.YEAR,-1);
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH);
        int day = c.get(Calendar.DAY_OF_MONTH);
        System.out.println(year+" "+month+" "+day);

        Date date = c.getTime();
        System.out.println(date);

    }
}
